import java.util.ArrayList;
import java.util.Collections;
import java.util.*;

public class TestStudent {
    public static void main(String[] args) {

        List<Student> list=new ArrayList<Student>();
        list.add(new Student(1001,"张三",100,95,76));
        list.add(new Student(1002,"李四",95 ,76,88));
        list.add(new Student(1003,"王五",79,88,75));
        list.add(new Student(1004,"赵六",95,60,83));

        System.out.println(list);

        Collections.shuffle(list);
        System.out.println(list);
        Collections.sort(list,new Comparator<Student>() {

            @Override
            public int compare(Student s1, Student s2)
            {
                if(s1.sum()>s2.sum())return -1;
                else if(s1.sum()<s2.sum()) return 1;
                return 0;
            }
        });
        System.out.println(list);
    }
}
